<?php
/*
Template Name: Search Page
*/
?>
<?php get_header(); ?>

<style media="screen" type="text/css">
form { 
margin: 0 auto; 
width:500px;
}

.rsrc-select
{
    -webkit-appearance: select;
	background: #e05d22; /* Old browsers */
	background: -webkit-linear-gradient(top, #e05d22 0%, #d94412 100%); /* Chrome 10+, Safari 5.1+ */
	background:   linear-gradient(to bottom, #e05d22 0%, #d94412 100%); /* W3C */
	border: none;
	border-bottom: 3px solid #b93207;
	border-radius: 2px;
	/*color: #b93207;*/
	display: inline-block;
	padding: 11px 10px 10px;
	text-decoration: none;
	width: 170px;
}

.rsrc-input
{
    width: 250px;
	border: 2px solid #b93207;
	height: 44px;
}
</style>

<form action="" method="POST">
<table>
<br>
<tr>
<select id="searchDropDownBox" class="rsrc-select" name="searchCategory">
<option selected="selected" value="searchAll">All</option>
<option value="searchBooks">Books</option>
<option value="searchSermons">Sermons</option>
<option value="searchBSNotes">Bible Study Notes</option>
<option value="searchWebRef">Web References</option>
</select>
<input type="text" name="f1" value="" class="rsrc-input"/>
<input type="submit" name="submit" value="Go"/>
</tr>
</table>
<br>
</form>
<?php echo 'We have got: ' . $_POST['f1'] . ''; ?>
<?php 
global $wpdb;	 
$queryStr = 'SELECT name FROM RSRC_Owner where name = "'. $_POST['f1'] . '"';	 
echo "<br>";
echo $queryStr; 	 
echo "<br>Category: ".$_POST['searchCategory'];
$results = $wpdb->get_results($queryStr);	 	 

if(!empty($results)) { 
     foreach($results as $r) {	 
          echo "<p>".$r->name."</p>"; 
     }
} else {
     echo "<p>Boo, we couldn't find anything that is in all these groups. Try removing a category!</p>";	 	 
} 
 ?>
<?php get_footer(); ?>